import {HashRouter as Hash,BrowserRouter as History,Route,Switch,Redirect} from 'react-router-dom'

import React,{lazy,Suspense} from 'react'

export function MainRouter(){
    return(
        <Hash>
            <Route component={RouterConfig}/>
        </Hash>
    )
}

function RouterConfig(){
    return(
        <div >
            <Suspense fallback={<div>bing...</div>}>
                <Switch>
                    <Route path="/" exact render={()=>(<Redirect to="/login"/>)} />
                    <Route path="/login"  component={lazy(()=>import('./logins/login'))}/>
                    <Route path="/register" component={lazy(()=>import('./logins/register'))}/>
                    <Route path="/forgetpass" component={lazy(()=>import('./logins/forgetpass'))}/>
                    <Route path="/main/" component={lazy(()=>import("./main"))}></Route>
                    
                    <Route path="/404" component={lazy(()=>import("./errorpage/404"))} />
                    <Route component={()=>(<Redirect to="/404"/>)} />
                </Switch>
            </Suspense>
        </div>
    )
}